import request from '@/utils/request'
import type { ArticleList, Article, QueryArticleParam, ArticleDetail } from '@/types/article'
import { PageVo } from '@/types/pagination'
/**
 * 获取文章前十
 * @returns
 */
export const queryHotArticleList = (): ResponseResult<ArticleList> =>
  request({
    url: `${import.meta.env.VITE_APP_BASE_API}/article/hotArticleList`,
    method: 'GET'
  })
/**
 * 分页查询文章
 * @returns
 */
export const queryArticleList = (data: QueryArticleParam): ResponseResult<PageVo<Article>> =>
  request({
    url: `${import.meta.env.VITE_APP_BASE_API}/article/articleList`,
    method: 'POST',
    data
  })
/**
 * 分页查询文章
 * @returns
 */
export const queryArticleDetail = (id: string): ResponseResult<ArticleDetail> =>
  request({
    url: `${import.meta.env.VITE_APP_BASE_API}/article/${id}`,
    method: 'GET'
  })
